<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>创建成功</title>

    <!-- icon小图标 -->
	<link rel="icon" href="../statics/images/icon_S_Bar_Contact.png" type="image/x-icon">
    <!-- layui -->
    <link rel="stylesheet" href="/statics/static/layui/css/layui.css">
    <style>
        .layui-layout-admin .layui-logo {
            left: 2rem;
            text-align: left;
            color: #fff;
        }

        #card-show a:hover {
            background-color: yellow;
            bottom: 2rem;
        }
    </style>
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onkeydown="on_return();">
    <div class="layui-layout layui-layout-admin">
        <!-- 顶部导航栏 -->


        <!--右侧主体内容区-->
        <div class="layui-body" style="left: 0rem;margin-top: 1rem;">
            <!-- <div class="layui-container">  -->
            <div class="layui-row">
                <div class="layui-col-md1 layui-col-xs1 layui-col-sm1">
                    &nbsp;
                </div>
                <div class="layui-col-md10 layui-col-xs10 layui-col-sm10">

                    <div class="layui-col-md12 layui-col-xs12 layui-col-sm12">
                        <div class="layui-panel">
                            <div style="padding: 5rem;text-align: center;font-size: 3rem; color: #5FB878;">
                                <img src="/statics/images/问卷.png" alt="" width="50" height="50">&nbsp;&nbsp;问卷创建成功！
                            </div>
                        </div>
                    </div>
                    <!-- <div id="btn" style="margin-right: 55rem;text-align: center;">

                    </div> -->
                    <div class="layui-row">
                        <div class="layui-col-md1 layui-col-sm1 layui-col-xs1">
                            <button type="button" class="layui-btn" id="sub" onclick="share()"
                                style="margin-top: 2rem;">分享问卷</button>
                        </div>
                        <div
                            class="layui-col-md1 layui-col-md-offset10 layui-col-xs1 layui-col-xs-offset7 layui-col-sm1 layui-col-sm-offset9">
                            <button type="button" class="layui-btn layui-btn-primary" onclick="cancel()"
                                style="margin-top: 2rem;">回到首页</button>
                        </div>
                    </div>



                </div>
                <div class="layui-col-md1 layui-col-xs1 layui-col-sm1">
                    &nbsp;
                </div>
            </div>
            <!-- </div> -->



        </div>


        <div class="layui-footer" style="left: 0rem;">
            <!-- 底部固定区域 -->
            © Questionnaire survey system
        </div>
    </div>
    <!-- jquery -->
    <script src="/statics/js/jquery-3.6.0.min.js"></script>
    <!-- clipboard -->
    <script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
    <!-- axios -->
    <script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
    <!-- vue -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <!-- layui -->
    <script src="/statics/static/layui/layui.js"></script>
    
    <!-- js代码 -->
    <script>
        // 复制内容到剪切板
        function copyText(text) {
            var input = document.createElement('input');

            input.setAttribute('id', 'input_for_copyText');
            input.value = text;

            document.getElementsByTagName('body')[0].appendChild(input);
            document.getElementById('input_for_copyText').select();
            document.execCommand('copy');
            document.getElementById('input_for_copyText').remove();
        }
        function share() {
            let id = Number(location.search.substring(4));
            let host = window.location.host + "/countShow?id=" + id;;
            // let url =  window.location.href = "/countShow?id="+id;
            layer.open({
                title: "分享链接",
                content: host, //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
                btn: ['复制链接', '取消']
                , yes: function (index, layero) {
                    if (host !== null && host !== "") {
                        copyText(host);
                        layer.msg('复制成功');
                    } else {
                        layer.msg('复制失败,链接为空');
                    }
                }
                , btn2: function (index, layero) {
                    //按钮【按钮二】的回调

                    // return false //开启该代码可禁止点击该按钮关闭
                }
            })
        }

        // 返回首页
        function cancel() {
            window.location.href = "/work"
        }

         //回车时，默认是登陆
         function on_return() {
            if (window.event.keyCode == 13) {
                if (document.all('sub') != null) {
                    document.all('sub').click();
                }
            }
        }
    </script>
    <!-- 结束代码 -->
</body>

</html>